package com.codingman.jpademo4;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

public class Demo3 {
	public static void main(String[] args) {
		EntityManagerFactory emf = Persistence.createEntityManagerFactory("employee_unit");
		EntityManager em = emf.createEntityManager();

		em.getTransaction().begin();
		
		Query query = em.createQuery("delete from Employee where e.id = :id"); 
		query.setParameter("id", 101);
		query.executeUpdate();

		em.getTransaction().commit();

		em.close();
		emf.close();
	}
}
